<?php 
include("../conn.php");
$page = 0;
$pagesize = 10;
$userid = null;

if(empty($_GET['userid']) && !is_numeric($_GET['userid'])){
	echo json_encode(array('code'=>-100,'msg'=>'用户信息异常'));
	exit;
}
$userid = $_GET['userid'];
if (isset($_GET['page']) && is_numeric($_GET['page'])) {
	$page = $_GET['page'];
}
if (isset($_GET['pagesize']) && is_numeric($_GET['pagesize'])) {
	$pagesize = $_GET['pagesize'];
}

$page*=$pagesize;

$sql = 'select * from user_invoice where userid = '.$userid.' and is_delete = 0 ORDER BY id DESC  limit '.$page.','.$pagesize;
$query = mysql_query($sql);
if(!$query){
	echo json_encode(array('code'=>-100,'msg'=>'查询信息错误'));
	exit;

}
$data = array('code'=>200,'data'=>array(),'msg'=>'获取成功');
while ($row = mysql_fetch_assoc($query )) {
	$data['data'][] = $row;
}
echo json_encode($data);





 ?>